package com.mgface.eth;

import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.http.HttpService;

import java.util.concurrent.ExecutionException;

/**
 * @author wanyuxiang
 * @version 1.0
 * @project web3jEthereum
 * @create 2018-06-25 15:51
 **/
public class Web3J {

	public static void main(String[] args) {
		Web3j web3 = Web3j.build(new HttpService("https://ropsten.infura.io/IY77yuopq4bSgHoaFqJe"));
		Web3ClientVersion web3ClientVersion;
		try {
			web3ClientVersion = web3.web3ClientVersion().sendAsync().get();
			String clientVersion = web3ClientVersion.getWeb3ClientVersion();
			System.out.println(clientVersion);
		} catch (InterruptedException|ExecutionException e) {
			e.printStackTrace();
		}finally {
			web3.shutdown();
		}
	}
}
